/*
 * Jp_DetailsClientP.java
 *
 * Created on 6 avril 2008, 13:59
 */

package gui;

import IBO.IClient;
import IBO.IClientParticulier;
import IBO.IIntervention;
import IBO.ITechnicien;
import boerrors.ClientInexistantException;
import boerrors.CodePostalMinimumMultiplicityException;
import boerrors.TechnicienMinimumMultiplicityException;
import boerrors.ZoneMinimumMultiplicityException;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author  olivierm
 */
public class Jp_DetailsClientP extends javax.swing.JPanel {
    
    private Frm_Application _parent = null;
    private DefaultTableModel _InterventionsCloturee = new DefaultTableModel();
    private DefaultTableModel _InterventionsOuverte = new DefaultTableModel();
    private String[] _colInterventionsOuverte = {"Id","Date","Priorité de la demande","Priorité de l'intervention"};
    private IClientParticulier _cltP = null;
    private Vector<IIntervention> _listeInterventions = null;

    public void refreshInterventions(){
        
        String[] objTmp = new String[4];
        try {
            this._InterventionsOuverte.setRowCount(0);
            //System.out.println("Nombre d'intervention: " + String.valueOf(this._cltP.getListeInterventions().size()));
            this._listeInterventions = this._cltP.getListeInterventions();
            if (this._listeInterventions != null){
                for (int i = 0; i < this._listeInterventions.size(); i++){
                    objTmp[0] = String.valueOf(this._listeInterventions.get(i).getIdIntervention());
                    DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
                    Date dateDate = this._listeInterventions.get(i).getDateDemande().getTime();
                    String dateFormatee = dateFormat.format(dateDate);
                    objTmp[1] = dateFormatee;
                    objTmp[2] = this._listeInterventions.get(i).getPrioriteDemande();
                    objTmp[3] = this._listeInterventions.get(i).getPrioriteIntervention();
                    this._InterventionsOuverte.addRow(objTmp);
                }
            }
            jlbl_NbrElementsIEC.setText(String.valueOf(this._InterventionsOuverte.getRowCount()));
        } catch (RemoteException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        }        
    }
    
    public void initComponents2(Frm_Application parent){
        this._parent = parent;
        this._InterventionsOuverte.setColumnIdentifiers(_colInterventionsOuverte);
        //refreshInterventions();
    }    
    
    public void setClient(IClientParticulier clientP) throws CodePostalMinimumMultiplicityException{
        try {

            this._cltP = clientP;
            jtxt_NumClient.setText(String.valueOf(this._cltP.getIdClient()));
            jtxt_Nom.setText(this._cltP.getNom());
            jtxt_Prenom.setText(this._cltP.getPrenom());
            jtxt_Email.setText(this._cltP.getEmail());
            jtxt_Telephone.setText(this._cltP.getTelephone());
            jtxt_NumTVA.setText(this._cltP.getNumeroTva());
            jtxt_Rue.setText(this._cltP.getIAdresse().getRue());
            jtxt_Numero.setText(this._cltP.getIAdresse().getNumero());
            jtxt_CP.setText(this._cltP.getIAdresse().getICodePostal().getCodePostal());
            jtxt_Commune.setText(this._cltP.getIAdresse().getICodePostal().getVille());
            jtxt_Zone.setText(String.valueOf(this._cltP.getIAdresse().getICodePostal().getZone().getIdZone()));
        } catch (ZoneMinimumMultiplicityException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        }

            
    }
    
    /** Creates new form Jp_DetailsClientP */
    public Jp_DetailsClientP() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel7 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jbtn_Modifier = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jPanel1 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jtxt_Nom = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jtxt_Prenom = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jtxt_NumTVA = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jtxt_Email = new javax.swing.JTextField();
        jtxt_Telephone = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jtxt_NumClient = new javax.swing.JTextField();
        jPanel9 = new javax.swing.JPanel();
        jtxt_Rue = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jtxt_Numero = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jtxt_CP = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jtxt_Commune = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jtxt_Zone = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jToolBar2 = new javax.swing.JToolBar();
        jbtn_Details = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jbtn_InterventionCreer = new javax.swing.JButton();
        jSeparator6 = new javax.swing.JToolBar.Separator();
        jbtn_InterventionModifier = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jbnt_Supprimer = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jbtn_InterventionORrefresh = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable_InterventionsCours = new javax.swing.JTable();
        jXStatusBar1 = new org.jdesktop.swingx.JXStatusBar();
        jLabel13 = new javax.swing.JLabel();
        jlbl_NbrElementsIEC = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jToolBar3 = new javax.swing.JToolBar();
        jbtn_IntervnetionODetails = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        jbtn_InterventionCRefresh = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable_InterventionsCloturee = new javax.swing.JTable();
        jXStatusBar2 = new org.jdesktop.swingx.JXStatusBar();
        jLabel14 = new javax.swing.JLabel();
        jlbl_NbrElementICL = new javax.swing.JLabel();

        setLayout(new java.awt.BorderLayout());

        jPanel7.setBackground(new java.awt.Color(0, 102, 153));
        jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel11.setFont(new java.awt.Font("Tahoma", 3, 14));
        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText("Détails d'un client particulier");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addContainerGap(528, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel11)
                .addContainerGap())
        );

        add(jPanel7, java.awt.BorderLayout.NORTH);

        jPanel6.setLayout(new java.awt.BorderLayout());

        jPanel4.setLayout(new java.awt.BorderLayout());

        jToolBar1.setFloatable(false);

        jbtn_Modifier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/user_edit.png"))); // NOI18N
        jbtn_Modifier.setText("Modifier");
        jbtn_Modifier.setFocusable(false);
        jbtn_Modifier.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_Modifier.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtn_Modifier.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_ModifierActionPerformed(evt);
            }
        });
        jToolBar1.add(jbtn_Modifier);
        jToolBar1.add(jSeparator1);

        jPanel4.add(jToolBar1, java.awt.BorderLayout.NORTH);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Détails"));

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information Client"));

        jtxt_Nom.setEditable(false);

        jLabel1.setText("Nom:");

        jtxt_Prenom.setEditable(false);

        jLabel2.setText("Prénom:");

        jtxt_NumTVA.setEditable(false);

        jLabel5.setText("Numéro de TVA:");

        jLabel4.setText("Email:");

        jtxt_Email.setEditable(false);

        jtxt_Telephone.setEditable(false);

        jLabel3.setText("Téléphone:");

        jLabel12.setText("Numéro Client:");

        jtxt_NumClient.setEditable(false);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel5)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtxt_NumClient, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(jtxt_Nom, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(jtxt_Prenom, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(jtxt_NumTVA, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(jtxt_Telephone, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                    .addComponent(jtxt_Email, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jtxt_NumClient, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_Nom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_Prenom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_NumTVA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_Telephone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_Email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap())
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Adresse du client"));

        jtxt_Rue.setEditable(false);

        jLabel6.setText("Rue:");

        jtxt_Numero.setEditable(false);

        jLabel10.setText("Numéro:");

        jtxt_CP.setEditable(false);

        jLabel7.setText("Code Postal:");

        jtxt_Commune.setEditable(false);

        jLabel9.setText("Commune:");

        jtxt_Zone.setEditable(false);

        jLabel8.setText("Zone:");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel10)
                    .addComponent(jLabel7)
                    .addComponent(jLabel9)
                    .addComponent(jLabel8))
                .addGap(18, 18, 18)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtxt_Commune, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
                    .addComponent(jtxt_Numero, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
                    .addComponent(jtxt_Zone, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
                    .addComponent(jtxt_Rue, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
                    .addComponent(jtxt_CP, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jtxt_Rue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jtxt_Numero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jtxt_CP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_Commune, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jtxt_Zone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(53, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel4.add(jPanel1, java.awt.BorderLayout.CENTER);

        jPanel6.add(jPanel4, java.awt.BorderLayout.NORTH);

        jPanel5.setLayout(new java.awt.BorderLayout());

        jPanel2.setLayout(new java.awt.BorderLayout());

        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);

        jbtn_Details.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/help.png"))); // NOI18N
        jbtn_Details.setText("Détails");
        jbtn_Details.setFocusable(false);
        jbtn_Details.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_Details.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtn_Details.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_DetailsActionPerformed(evt);
            }
        });
        jToolBar2.add(jbtn_Details);
        jToolBar2.add(jSeparator3);

        jbtn_InterventionCreer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/date_add.png"))); // NOI18N
        jbtn_InterventionCreer.setText("Créer");
        jbtn_InterventionCreer.setFocusable(false);
        jbtn_InterventionCreer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_InterventionCreer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtn_InterventionCreer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_InterventionCreerActionPerformed(evt);
            }
        });
        jToolBar2.add(jbtn_InterventionCreer);
        jToolBar2.add(jSeparator6);

        jbtn_InterventionModifier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/date_edit.png"))); // NOI18N
        jbtn_InterventionModifier.setText("Modifier");
        jbtn_InterventionModifier.setFocusable(false);
        jbtn_InterventionModifier.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_InterventionModifier.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jbtn_InterventionModifier);
        jToolBar2.add(jSeparator4);

        jbnt_Supprimer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/date_delete.png"))); // NOI18N
        jbnt_Supprimer.setText("Supprimer");
        jbnt_Supprimer.setFocusable(false);
        jbnt_Supprimer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbnt_Supprimer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jbnt_Supprimer);
        jToolBar2.add(jSeparator2);

        jbtn_InterventionORrefresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/database_refresh.png"))); // NOI18N
        jbtn_InterventionORrefresh.setText("Rafraichir");
        jbtn_InterventionORrefresh.setFocusable(false);
        jbtn_InterventionORrefresh.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_InterventionORrefresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtn_InterventionORrefresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_InterventionORrefreshActionPerformed(evt);
            }
        });
        jToolBar2.add(jbtn_InterventionORrefresh);

        jPanel2.add(jToolBar2, java.awt.BorderLayout.NORTH);

        jTable_InterventionsCours.setModel(_InterventionsOuverte);
        jScrollPane1.setViewportView(jTable_InterventionsCours);

        jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        jLabel13.setText("Nombre d'éléments: ");
        jXStatusBar1.add(jLabel13);

        jlbl_NbrElementsIEC.setText("0");
        jXStatusBar1.add(jlbl_NbrElementsIEC);

        jPanel2.add(jXStatusBar1, java.awt.BorderLayout.SOUTH);

        jTabbedPane1.addTab("Interventions en cours", jPanel2);

        jPanel3.setLayout(new java.awt.BorderLayout());

        jToolBar3.setFloatable(false);
        jToolBar3.setRollover(true);

        jbtn_IntervnetionODetails.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/help.png"))); // NOI18N
        jbtn_IntervnetionODetails.setText("Details");
        jbtn_IntervnetionODetails.setFocusable(false);
        jbtn_IntervnetionODetails.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_IntervnetionODetails.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(jbtn_IntervnetionODetails);
        jToolBar3.add(jSeparator5);

        jbtn_InterventionCRefresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/database_refresh.png"))); // NOI18N
        jbtn_InterventionCRefresh.setText("Rafrachir");
        jbtn_InterventionCRefresh.setFocusable(false);
        jbtn_InterventionCRefresh.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jbtn_InterventionCRefresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(jbtn_InterventionCRefresh);

        jPanel3.add(jToolBar3, java.awt.BorderLayout.NORTH);

        jTable_InterventionsCloturee.setModel(_InterventionsCloturee);
        jScrollPane2.setViewportView(jTable_InterventionsCloturee);

        jPanel3.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jLabel14.setText("Nombre d'éléments: ");
        jXStatusBar2.add(jLabel14);

        jlbl_NbrElementICL.setText("0");
        jXStatusBar2.add(jlbl_NbrElementICL);

        jPanel3.add(jXStatusBar2, java.awt.BorderLayout.SOUTH);

        jTabbedPane1.addTab("Interventions cloturées", jPanel3);

        jPanel5.add(jTabbedPane1, java.awt.BorderLayout.CENTER);

        jPanel6.add(jPanel5, java.awt.BorderLayout.CENTER);

        add(jPanel6, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void jbtn_InterventionCreerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_InterventionCreerActionPerformed
        try {

            Jd_CreerIntervention objCi = new Jd_CreerIntervention(this._parent, true);
            objCi.initComponents2(this._parent, (IClient) _cltP);
            objCi.setVisible(true);
        } catch (RemoteException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_jbtn_InterventionCreerActionPerformed

    private void jbtn_ModifierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_ModifierActionPerformed
        try {

            Jd_ModifierClientP objCp = new Jd_ModifierClientP(_parent, true);
            objCp.initComponents2(this._parent, this, _cltP);
            objCp.setVisible(true);
        } catch (CodePostalMinimumMultiplicityException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_jbtn_ModifierActionPerformed

    private void jbtn_InterventionORrefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_InterventionORrefreshActionPerformed

//        String[] objTmp = new String[4];
//        try {
//            this._InterventionsOuverte.setRowCount(0);
//            //System.out.println("Nombre d'intervention: " + String.valueOf(this._cltP.getListeInterventions().size()));
//            this._listeInterventions = this._cltP.getListeInterventions();
//            for (int i = 0; i < this._listeInterventions.size(); i++){
//                objTmp[0] = String.valueOf(this._listeInterventions.get(i).getIdIntervention());
//                DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
//                Date dateDate = this._listeInterventions.get(i).getDateDemande().getTime();
//                String dateFormatee = dateFormat.format(dateDate);
//                objTmp[1] = dateFormatee;
//                objTmp[2] = this._listeInterventions.get(i).getPrioriteDemande();
//                objTmp[3] = this._listeInterventions.get(i).getPrioriteIntervention();
//                this._InterventionsOuverte.addRow(objTmp);
//            }
//        } catch (RemoteException ex) {
//            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
//        }
          refreshInterventions();  
        
    }//GEN-LAST:event_jbtn_InterventionORrefreshActionPerformed

    private void jbtn_DetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_DetailsActionPerformed
        try {

            IIntervention _intervention = this._listeInterventions.elementAt(jTable_InterventionsCours.getSelectedRow());
            ITechnicien _technicien = ((IIntervention) this._listeInterventions.elementAt(jTable_InterventionsCours.getSelectedRow())).getITechnicien();
            IClient _client = ((IIntervention) this._listeInterventions.elementAt(jTable_InterventionsCours.getSelectedRow())).getIClient();
            Jd_DetailsIntervention obj = new Jd_DetailsIntervention(_parent, true);
            obj.initComponents2(this._parent);
            obj.setInformations(_intervention, _technicien, _client);
            obj.setVisible(true);
        } catch (RemoteException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClientInexistantException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        } catch (TechnicienMinimumMultiplicityException ex) {
            Logger.getLogger(Jp_DetailsClientP.class.getName()).log(Level.SEVERE, null, ex);
        }  catch (NullPointerException ex){
            JOptionPane.showMessageDialog(this,"Veuillez sélectionner une intervention.","Information",JOptionPane.INFORMATION_MESSAGE);
        } catch (ArrayIndexOutOfBoundsException ex){
            JOptionPane.showMessageDialog(this,"Veuillez sélectionner une intervention.","Information",JOptionPane.INFORMATION_MESSAGE);
        }
        
    }//GEN-LAST:event_jbtn_DetailsActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar.Separator jSeparator6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable_InterventionsCloturee;
    private javax.swing.JTable jTable_InterventionsCours;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToolBar jToolBar3;
    private org.jdesktop.swingx.JXStatusBar jXStatusBar1;
    private org.jdesktop.swingx.JXStatusBar jXStatusBar2;
    private javax.swing.JButton jbnt_Supprimer;
    private javax.swing.JButton jbtn_Details;
    private javax.swing.JButton jbtn_InterventionCRefresh;
    private javax.swing.JButton jbtn_InterventionCreer;
    private javax.swing.JButton jbtn_InterventionModifier;
    private javax.swing.JButton jbtn_InterventionORrefresh;
    private javax.swing.JButton jbtn_IntervnetionODetails;
    private javax.swing.JButton jbtn_Modifier;
    private javax.swing.JLabel jlbl_NbrElementICL;
    private javax.swing.JLabel jlbl_NbrElementsIEC;
    private javax.swing.JTextField jtxt_CP;
    private javax.swing.JTextField jtxt_Commune;
    private javax.swing.JTextField jtxt_Email;
    private javax.swing.JTextField jtxt_Nom;
    private javax.swing.JTextField jtxt_NumClient;
    private javax.swing.JTextField jtxt_NumTVA;
    private javax.swing.JTextField jtxt_Numero;
    private javax.swing.JTextField jtxt_Prenom;
    private javax.swing.JTextField jtxt_Rue;
    private javax.swing.JTextField jtxt_Telephone;
    private javax.swing.JTextField jtxt_Zone;
    // End of variables declaration//GEN-END:variables
    
}
